//
//  CircleViewController.m
//  Frame
//
//  Created by 这是工作本 on 16/3/1.
//  Copyright © 2016年 这是工作本. All rights reserved.
//

#import "CircleViewController.h"

@interface CircleViewController () <UICollectionViewDataSource , UICollectionViewDelegate, UITableViewDataSource, UITableViewDelegate, UIGestureRecognizerDelegate>
@property (nonatomic, retain) UICollectionView *HcollectionV;
@property (nonatomic, retain) UICollectionView *VcollectionV;
@property (nonatomic, retain) UIView *scrollView;
@property (nonatomic, assign) NSInteger begin_scroll;
@property (nonatomic, retain) NSArray *titlearr;
@property (nonatomic, retain) UILabel *la;
@property (nonatomic, retain) UIButton *bu;
@property (nonatomic, retain) UIImageView *image;
@property (nonatomic, retain) UIButton *attention;
@property (nonatomic, retain) UIButton *Dangmyeon;
@property (nonatomic, retain) UIButton *tribe;
@property (nonatomic, retain) UIButton *interface;
@property (nonatomic, retain) UIView *viewD;
@property (nonatomic, retain) UILabel *basketball;
@property (nonatomic, retain) UIButton *button;
@property (nonatomic, retain) UILabel *la1;
@property (nonatomic, retain) UILabel *la2;
@property (nonatomic, retain) UILabel *la3;
@property (nonatomic, retain) UILabel *la4;
@property (nonatomic, retain) UILabel *la5;

@property (nonatomic, retain) UIButton *bu1;
@property (nonatomic, retain) UIButton *bu2;
@property (nonatomic, retain) UIButton *bu3;
@property (nonatomic, retain) UIButton *bu4;
@property (nonatomic, retain) UILabel *attentionL;
@property (nonatomic, retain) UIView *viewF;
@property (nonatomic, retain) UILabel *laD;
@property (nonatomic, retain) UIView *viewS;
@property (nonatomic, retain) UILabel *laT;
@property (nonatomic, retain) UIButton *Concern;
@property (nonatomic, retain) UICollectionView *Classification;
@property (nonatomic, retain) UITableView *tableV;
@end

@implementation CircleViewController


- (void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    self.navigationItem.title = @"屯儿";
    //隐藏自动返回
    self.navigationItem.hidesBackButton = YES;
    
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:29 / 255.0 green:127 / 255.0  blue:140 / 255.0  alpha:1.0];
    
    //返回按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"but_an.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]style:UIBarButtonItemStylePlain target:self action:@selector(leftBarButtonAction:)];
    
    //设置title颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1.0],NSForegroundColorAttributeName,nil]];
    
    //搜索
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"搜索" style:UIBarButtonItemStylePlain target:self action:@selector(searchAction:)];
    
    //设置字体颜色大小
    [self.navigationItem.rightBarButtonItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                   [UIFont fontWithName:@"Helvetica" size:16.0 * ScreenWidth], NSFontAttributeName, [UIColor colorWithRed:255 / 255.0 green:255 / 255.0  blue:255 / 255.0  alpha:1.0], NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
    
    //视图控制器
    //横向collectionView
    UICollectionViewFlowLayout *flowL_H = [[UICollectionViewFlowLayout alloc] init];
    //最小行间距
    flowL_H.minimumLineSpacing = 10 * ScreenWidth;
    //滚动方向
    flowL_H.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    //单位大小
    flowL_H.itemSize = CGSizeMake(([UIScreen mainScreen].bounds.size.width - 30 * ScreenWidth) / 3, 40 * ScreenHeigth);
    //与屏幕四边的间距
    flowL_H.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    
    self.HcollectionV = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, 50 * ScreenHeigth) collectionViewLayout:flowL_H];
    //隐藏指示条
    self.HcollectionV.showsHorizontalScrollIndicator = NO;
    //关掉滑动
    self.HcollectionV.scrollEnabled = YES;
    //关闭自动偏移
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.HcollectionV.backgroundColor = [UIColor colorWithRed:255 / 255.0  green:255 / 255.0 blue:255 / 255.0 alpha:1.0];
    self.HcollectionV.contentOffset = CGPointMake([[UIScreen mainScreen] bounds].size.width  / 3,  0);
    //签协议
    self.HcollectionV.delegate = self;
    self.HcollectionV.dataSource = self;
    //注册cell
    [self.HcollectionV registerClass:[CircleCollectionViewCell class] forCellWithReuseIdentifier:@"horizontalCell"];
    self.HcollectionV.bounces = NO;
    self.HcollectionV.pagingEnabled = YES;
    
    [self.view addSubview:self.HcollectionV];
    
    
    //分割线
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 39 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 1 * ScreenHeigth)];
    view.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.HcollectionV addSubview:view];
    
    //滑条
    self.scrollView = [[UIView alloc] initWithFrame:CGRectMake(5 * ScreenWidth, 36 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width / 3 - 3 * 10 * ScreenWidth, 3 * ScreenHeigth)];
    self.scrollView.backgroundColor = [UIColor colorWithRed:29 / 255.0 green:127 / 255.0 blue:140 / 255.0 alpha:1.0];
    [self.HcollectionV addSubview:self.scrollView];
   
    //数据
    
    self.titlearr = [NSArray arrayWithObjects:@"兴趣圈", @"最近", @"排行", nil];
    
    
    //关注部落以后, 这里将展示部落最新内容
    
    
    self.la = [[UILabel alloc] initWithFrame:CGRectMake(0, self.scrollView.frame.origin.y + self.scrollView.frame.size.height + 200 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 26 * ScreenHeigth)];
    self.la.text = @"关注部落以后, 这里将展示部落最新内容";
    self.la.font = [UIFont systemFontOfSize:13.0 * ScreenWidth];
    self.la.textAlignment = NSTextAlignmentCenter;
    self.la.textColor = [UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0];

    [self.view addSubview:self.la];

    //你可能感兴趣的部落
    
    self.viewD = [[UIView alloc] initWithFrame:CGRectMake(0, self.la.frame.origin.y + self.la.frame.size.height + 100 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 1 * ScreenHeigth)];
    self.viewD.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    [self.view addSubview:self.viewD];

    self.bu = [UIButton buttonWithType:UIButtonTypeCustom];
    self.bu.frame = CGRectMake(20 * ScreenWidth, self.viewD.frame.origin.y + self.viewD.frame.size.height + 20 * ScreenHeigth, ([UIScreen mainScreen].bounds.size.width - 100 * ScreenWidth) / 3, 100);
    [self.bu setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
    self.bu.layer.masksToBounds = YES;
    self.bu.layer.cornerRadius = 10 * ScreenWidth;
    [self.bu addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.bu];
    
    self.basketball = [[UILabel alloc] initWithFrame:CGRectMake(self.bu.frame.origin.x, self.bu.frame.origin.y + self.bu.frame.size.height + 5 * ScreenHeigth, self.bu.frame.size.width, 26 * ScreenHeigth)];
    self.basketball.text = @"篮球";
    self.basketball.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.basketball];
    
    
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button.frame = CGRectMake(self.bu.frame.origin.x + self.bu.frame.size.width + 30 * ScreenWidth, self.bu.frame.origin.y, self.bu.frame.size.width, self.bu.frame.size.height);
    [self.button setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
    self.button.layer.masksToBounds = YES;
    self.button.layer.cornerRadius = 10 * ScreenWidth;
    [self.button addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.button];
    
    self.la1 = [[UILabel alloc] initWithFrame:CGRectMake(self.button.frame.origin.x, self.button.frame.origin.y + self.button.frame.size.height + 5 * ScreenHeigth, self.button.frame.size.width, 26 * ScreenHeigth)];
    self.la1.text = @"篮球";
    self.la1.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.la1];

    
    self.bu1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.bu1.frame = CGRectMake(self.button.frame.origin.x + self.button.frame.size.width + 30 * ScreenWidth, self.button.frame.origin.y, self.button.frame.size.width, self.button.frame.size.height);
    [self.bu1 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
    self.bu1.layer.masksToBounds = YES;
    self.bu1.layer.cornerRadius = 10 * ScreenWidth;
    [self.bu1 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.bu1];
    
    self.la2 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu1.frame.origin.x, self.bu1.frame.origin.y + self.bu1.frame.size.height + 5 * ScreenHeigth, self.bu1.frame.size.width, 26 * ScreenHeigth)];
    self.la2.text = @"篮球";
    self.la2.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.la2];
    
    
    self.bu2 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.bu2.frame = CGRectMake(self.bu.frame.origin.x, self.bu.frame.origin.y + self.bu.frame.size.height + 30 * ScreenHeigth, self.bu.frame.size.width, self.bu.frame.size.height);
    [self.bu2 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
    self.bu2.layer.masksToBounds = YES;
    self.bu2.layer.cornerRadius = 10 * ScreenWidth;
    [self.bu2 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.bu2];
    
    self.la3 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu2.frame.origin.x, self.bu2.frame.origin.y + self.bu2.frame.size.height + 5 * ScreenHeigth, self.bu2.frame.size.width, 26 * ScreenHeigth)];
    self.la3.text = @"篮球";
    self.la3.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.la3];
    
    
    self.bu3 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.bu3.frame = CGRectMake(self.bu2.frame.origin.x + self.bu2.frame.size.width + 30 * ScreenWidth, self.bu2.frame.origin.y, self.bu2.frame.size.width, self.bu2.frame.size.height);
    [self.bu3 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
    self.bu3.layer.masksToBounds = YES;
    self.bu3.layer.cornerRadius = 10 * ScreenWidth;
    [self.bu3 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.bu3];
    
    self.la4 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu3.frame.origin.x, self.bu3.frame.origin.y + self.bu3.frame.size.height + 5 * ScreenHeigth, self.bu3.frame.size.width, 26 * ScreenHeigth)];
    self.la4.text = @"篮球";
    self.la4.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.la4];
    
    
    self.bu4 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.bu4.frame = CGRectMake(self.bu3.frame.origin.x + self.bu3.frame.size.width + 30 * ScreenWidth, self.bu3.frame.origin.y, self.bu3.frame.size.width, self.bu3.frame.size.height);
    [self.bu4 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
    self.bu4.layer.masksToBounds = YES;
    self.bu4.layer.cornerRadius = 10 * ScreenWidth;
    [self.bu4 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.bu4];
    
    self.la5 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu4.frame.origin.x, self.bu4.frame.origin.y + self.bu4.frame.size.height + 5 * ScreenHeigth, self.bu4.frame.size.width, 26 * ScreenHeigth)];
    self.la5.text = @"篮球";
    self.la5.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.la5];

    
}

//返回按钮
- (void)leftBarButtonAction:(UIBarButtonItem *)sender
{
    
    
    [self.navigationController popViewControllerAnimated:YES];
}

//搜索按钮

- (void)searchAction:(UIBarButtonItem *)sender
{

    
    
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    if (self.HcollectionV == collectionView) {
        
        return 3;
    } else {
    
        return 20;
    }
    
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.HcollectionV == collectionView) {
        
        
        CircleCollectionViewCell *cir = [collectionView dequeueReusableCellWithReuseIdentifier:@"horizontalCell" forIndexPath:indexPath];
        
        [cir cellForTitle:[self.titlearr objectAtIndex:indexPath.row]];
        return cir;

        
    } else
    {
        
        ClassificationCollectionViewCell *class = [collectionView dequeueReusableCellWithReuseIdentifier:@"ClassificationCell" forIndexPath:indexPath];
        
        return class;

        
    }

        
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    NSString *cellStr = @"cell";
    RingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr];
    if (nil == cell) {
        
        cell = [[RingTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellStr];
    }
    
    
    
    //清除选中色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 67 * ScreenHeigth;
}

//点击触发
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    if (self.HcollectionV == collectionView) {
        //动画滑块 点击改变滑块位置
        [UIView animateWithDuration:0.2 animations:^{
            
            self.scrollView.frame = CGRectMake(5 * ScreenWidth + ([UIScreen mainScreen].bounds.size.width / 3) * indexPath.row, 36 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width / 3 - 3 * 10 * ScreenWidth, 3 * ScreenHeigth);
            
        }];
        //改变collection的偏移量
        [self.VcollectionV setContentOffset:CGPointMake(self.view.frame.size.width * indexPath.row, 0) animated:YES];
        //滑块一起移动->体验非常好
        self.begin_scroll = indexPath.row;
        [collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];
        
        
        
    }
    
    if (0 == indexPath.row) {
        
        [self.image removeFromSuperview];
        [self.attention removeFromSuperview];
        [self.attentionL removeFromSuperview];
        [self.viewF removeFromSuperview];
        [self.Dangmyeon removeFromSuperview];
        [self.laD removeFromSuperview];
        [self.viewS removeFromSuperview];
        [self.tribe removeFromSuperview];
        [self.laT removeFromSuperview];
        [self.interface removeFromSuperview];
        [self.Classification removeFromSuperview];
        [self.tableV removeFromSuperview];

        
        
        //关注部落以后, 这里将展示部落最新内容
        
        
        self.la = [[UILabel alloc] initWithFrame:CGRectMake(0, self.scrollView.frame.origin.y + self.scrollView.frame.size.height + 200 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 26 * ScreenHeigth)];
        self.la.text = @"关注部落以后, 这里将展示部落最新内容";
        self.la.font = [UIFont systemFontOfSize:13.0 * ScreenWidth];
        self.la.textAlignment = NSTextAlignmentCenter;
        self.la.textColor = [UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0];
        
        [self.view addSubview:self.la];
        
        //你可能感兴趣的部落
        
        self.viewD = [[UIView alloc] initWithFrame:CGRectMake(0, self.la.frame.origin.y + self.la.frame.size.height + 100 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 1 * ScreenHeigth)];
        self.viewD.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
        [self.view addSubview:self.viewD];
        
        self.bu = [UIButton buttonWithType:UIButtonTypeCustom];
        self.bu.frame = CGRectMake(20 * ScreenWidth, self.viewD.frame.origin.y + self.viewD.frame.size.height + 20 * ScreenHeigth, ([UIScreen mainScreen].bounds.size.width - 100 * ScreenWidth) / 3, 100);
        [self.bu setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
        self.bu.layer.masksToBounds = YES;
        self.bu.layer.cornerRadius = 10 * ScreenWidth;
        [self.bu addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.bu];
        
        self.basketball = [[UILabel alloc] initWithFrame:CGRectMake(self.bu.frame.origin.x, self.bu.frame.origin.y + self.bu.frame.size.height + 5 * ScreenHeigth, self.bu.frame.size.width, 26 * ScreenHeigth)];
        self.basketball.text = @"篮球";
        self.basketball.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:self.basketball];
        
        
        self.button = [UIButton buttonWithType:UIButtonTypeCustom];
        self.button.frame = CGRectMake(self.bu.frame.origin.x + self.bu.frame.size.width + 30 * ScreenWidth, self.bu.frame.origin.y, self.bu.frame.size.width, self.bu.frame.size.height);
        [self.button setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
        self.button.layer.masksToBounds = YES;
        self.button.layer.cornerRadius = 10 * ScreenWidth;
        [self.button addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.button];
        
        self.la1 = [[UILabel alloc] initWithFrame:CGRectMake(self.button.frame.origin.x, self.button.frame.origin.y + self.button.frame.size.height + 5 * ScreenHeigth, self.button.frame.size.width, 26 * ScreenHeigth)];
        self.la1.text = @"篮球";
        self.la1.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:self.la1];
        
        
        self.bu1 = [UIButton buttonWithType:UIButtonTypeCustom];
        self.bu1.frame = CGRectMake(self.button.frame.origin.x + self.button.frame.size.width + 30 * ScreenWidth, self.button.frame.origin.y, self.button.frame.size.width, self.button.frame.size.height);
        [self.bu1 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
        self.bu1.layer.masksToBounds = YES;
        self.bu1.layer.cornerRadius = 10 * ScreenWidth;
        [self.bu1 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.bu1];
        
        self.la2 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu1.frame.origin.x, self.bu1.frame.origin.y + self.bu1.frame.size.height + 5 * ScreenHeigth, self.bu1.frame.size.width, 26 * ScreenHeigth)];
        self.la2.text = @"篮球";
        self.la2.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:self.la2];
        
        
        self.bu2 = [UIButton buttonWithType:UIButtonTypeCustom];
        self.bu2.frame = CGRectMake(self.bu.frame.origin.x, self.bu.frame.origin.y + self.bu.frame.size.height + 30 * ScreenHeigth, self.bu.frame.size.width, self.bu.frame.size.height);
        [self.bu2 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
        self.bu2.layer.masksToBounds = YES;
        self.bu2.layer.cornerRadius = 10 * ScreenWidth;
        [self.bu2 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.bu2];
        
        self.la3 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu2.frame.origin.x, self.bu2.frame.origin.y + self.bu2.frame.size.height + 5 * ScreenHeigth, self.bu2.frame.size.width, 26 * ScreenHeigth)];
        self.la3.text = @"篮球";
        self.la3.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:self.la3];
        
        
        self.bu3 = [UIButton buttonWithType:UIButtonTypeCustom];
        self.bu3.frame = CGRectMake(self.bu2.frame.origin.x + self.bu2.frame.size.width + 30 * ScreenWidth, self.bu2.frame.origin.y, self.bu2.frame.size.width, self.bu2.frame.size.height);
        [self.bu3 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
        self.bu3.layer.masksToBounds = YES;
        self.bu3.layer.cornerRadius = 10 * ScreenWidth;
        [self.bu3 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.bu3];
        
        self.la4 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu3.frame.origin.x, self.bu3.frame.origin.y + self.bu3.frame.size.height + 5 * ScreenHeigth, self.bu3.frame.size.width, 26 * ScreenHeigth)];
        self.la4.text = @"篮球";
        self.la4.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:self.la4];
        
        
        self.bu4 = [UIButton buttonWithType:UIButtonTypeCustom];
        self.bu4.frame = CGRectMake(self.bu3.frame.origin.x + self.bu3.frame.size.width + 30 * ScreenWidth, self.bu3.frame.origin.y, self.bu3.frame.size.width, self.bu3.frame.size.height);
        [self.bu4 setImage:[UIImage imageNamed:@"图层-57@2x.png"] forState:UIControlStateNormal];
        self.bu4.layer.masksToBounds = YES;
        self.bu4.layer.cornerRadius = 10 * ScreenWidth;
        [self.bu4 addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.bu4];
        
        self.la5 = [[UILabel alloc] initWithFrame:CGRectMake(self.bu4.frame.origin.x, self.bu4.frame.origin.y + self.bu4.frame.size.height + 5 * ScreenHeigth, self.bu4.frame.size.width, 26 * ScreenHeigth)];
        self.la5.text = @"篮球";
        self.la5.textAlignment = NSTextAlignmentCenter;
        [self.view addSubview:self.la5];
        

        

    }
    
    
    if (1 == indexPath.row) {
        
        [self.la removeFromSuperview];
        [self.la1 removeFromSuperview];
        [self.la2 removeFromSuperview];
        [self.la3 removeFromSuperview];
        [self.la4 removeFromSuperview];
        [self.la5 removeFromSuperview];
        [self.bu removeFromSuperview];
        [self.bu1 removeFromSuperview];
        [self.bu2 removeFromSuperview];
        [self.bu3 removeFromSuperview];
        [self.bu4 removeFromSuperview];
        [self.button removeFromSuperview];
        [self.viewD removeFromSuperview];
        [self.basketball removeFromSuperview];
        [self.Concern removeFromSuperview];
        [self.Classification removeFromSuperview];
        [self.tableV removeFromSuperview];
        
        
        
        
        //头像
        
        self.image = [[UIImageView alloc] initWithFrame:CGRectMake(10 * ScreenWidth, self.HcollectionV.frame.origin.y + self.HcollectionV.frame.size.height + 20 * ScreenHeigth, 50 * ScreenWidth, 50 * ScreenHeigth)];
        self.image.layer.masksToBounds = YES;
        self.image.layer.cornerRadius = 25 * ScreenWidth;
        self.image.image = [UIImage imageNamed:@"椭圆-18@2x 2.png"];
        [self.view addSubview:self.image];
        
        
        //关注
        
        self.attention = [UIButton buttonWithType:UIButtonTypeCustom];
        self.attention.frame = CGRectMake(self.image.frame.origin.x + self.image.frame.size.width + 50 * ScreenWidth, self.image.frame.origin.y, 40 * ScreenWidth, 20 * ScreenHeigth);
        [self.attention setTitle:@"0" forState:UIControlStateNormal];
        [self.attention setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self.attention addTarget:self action:@selector(attentionAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.attention];
        
        self.attentionL = [[UILabel alloc] initWithFrame:CGRectMake(self.attention.frame.origin.x, self.attention.frame.origin.y + self.attention.frame.size.height + 5 * ScreenHeigth, self.attention.frame.size.width, self.attention.frame.size.height)];
        self.attentionL.text = @"关注";
        self.attentionL.textAlignment = NSTextAlignmentCenter;
        self.attentionL.textColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
        [self.view addSubview:self.attentionL];

        //分割线
        
        self.viewF = [[UIView alloc] initWithFrame:CGRectMake(self.attention.frame.origin.x + self.attention.frame.size.width + 30 * ScreenWidth, self.attention.frame.origin.y + 10 * ScreenHeigth, 1 * ScreenHeigth, 30 * ScreenHeigth)];
        self.viewF.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
        [self.view addSubview:self.viewF];

        
        
        //粉粉丝
        
        self.Dangmyeon = [UIButton buttonWithType:UIButtonTypeCustom];
        self.Dangmyeon.frame = CGRectMake(self.viewF.frame.origin.x + self.viewF.frame.size.width + 40 * ScreenWidth, self.image.frame.origin.y, 40 * ScreenWidth, 20 * ScreenHeigth);
        [self.Dangmyeon setTitle:@"0" forState:UIControlStateNormal];
        [self.Dangmyeon setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self.Dangmyeon addTarget:self action:@selector(attentionAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.Dangmyeon];
        
        self.laD = [[UILabel alloc] initWithFrame:CGRectMake(self.Dangmyeon.frame.origin.x, self.Dangmyeon.frame.origin.y + self.Dangmyeon.frame.size.height + 5 * ScreenHeigth, self.Dangmyeon.frame.size.width, self.Dangmyeon.frame.size.height)];
        self.laD.text = @"粉丝";
        self.laD.textAlignment = NSTextAlignmentCenter;
        self.laD.textColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
        [self.view addSubview:self.laD];

        //分割线
        
        self.viewS = [[UIView alloc] initWithFrame:CGRectMake(self.Dangmyeon.frame.origin.x + self.Dangmyeon.frame.size.width + 30 * ScreenWidth, self.Dangmyeon.frame.origin.y + 10 * ScreenHeigth, 1 * ScreenHeigth, 30 * ScreenHeigth)];
        self.viewS.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
        [self.view addSubview:self.viewS];

        
        
        //部落
        
        self.tribe = [UIButton buttonWithType:UIButtonTypeCustom];
        self.tribe.frame = CGRectMake(self.viewD.frame.origin.x + self.viewD.frame.size.width + 40 * ScreenWidth, self.image.frame.origin.y, 40 * ScreenWidth, 20 * ScreenHeigth);
        [self.tribe setTitle:@"0" forState:UIControlStateNormal];
        [self.tribe setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self.tribe addTarget:self action:@selector(attentionAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.tribe];
        
        self.laT = [[UILabel alloc] initWithFrame:CGRectMake(self.tribe.frame.origin.x, self.tribe.frame.origin.y + self.tribe.frame.size.height + 5 * ScreenHeigth, self.tribe.frame.size.width, self.tribe.frame.size.height)];
        self.laT.text = @"部落";
        self.laT.textAlignment = NSTextAlignmentCenter;
        self.laT.textColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
        [self.view addSubview:self.laT];

        //最近访问
        
        self.interface = [UIButton buttonWithType:UIButtonTypeCustom];
        self.interface.frame = CGRectMake(0, self.image.frame.origin.y + self.image.frame.size.height + 20 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width, 40 * ScreenHeigth);
        //设置字体大小
        self.interface.titleLabel.font = [UIFont systemFontOfSize:15.0 * ScreenWidth];
        [self.interface setTitleColor:[UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0] forState:UIControlStateNormal];
        self.interface.backgroundColor = [UIColor colorWithRed:230 / 255.0 green:230 / 255.0 blue:230 / 255.0 alpha:1.0];
        [self.interface setTitle:@"最近访问" forState:UIControlStateNormal];
        //设置字体靠左
        self.interface.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        //设置字体位置
        self.interface.contentEdgeInsets = UIEdgeInsetsMake(0,10 * ScreenWidth, 0, 0);
        
        [self.interface addTarget:self action:@selector(interfaceAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:self.interface];

        
    } if (2 == indexPath.row) {
        
        
        [self.la removeFromSuperview];
        [self.la1 removeFromSuperview];
        [self.la2 removeFromSuperview];
        [self.la3 removeFromSuperview];
        [self.la4 removeFromSuperview];
        [self.la5 removeFromSuperview];
        [self.bu removeFromSuperview];
        [self.bu1 removeFromSuperview];
        [self.bu2 removeFromSuperview];
        [self.bu3 removeFromSuperview];
        [self.bu4 removeFromSuperview];
        [self.button removeFromSuperview];
        [self.viewD removeFromSuperview];
        [self.basketball removeFromSuperview];
        [self.Concern removeFromSuperview];
        
        [self.image removeFromSuperview];
        [self.attention removeFromSuperview];
        [self.attentionL removeFromSuperview];
        [self.viewF removeFromSuperview];
        [self.Dangmyeon removeFromSuperview];
        [self.laD removeFromSuperview];
        [self.viewS removeFromSuperview];
        [self.tribe removeFromSuperview];
        [self.laT removeFromSuperview];
        [self.interface removeFromSuperview];
        
        
        //纵向collectionView
        UICollectionViewFlowLayout *flowL_V = [[UICollectionViewFlowLayout alloc] init];
        //最小行间距
        flowL_V.minimumLineSpacing = 1 * ScreenHeigth;
        //滚动方向 垂直
        flowL_V.scrollDirection = UICollectionViewScrollDirectionVertical;
        //单位大小
        flowL_V.itemSize = CGSizeMake(75 * ScreenWidth, 48 * ScreenHeigth);
        //与屏幕四边的间距
        flowL_V.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
        
        self.Classification = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.HcollectionV.frame.origin.y + self.HcollectionV.frame.size.height, 75 * ScreenWidth, 860 * ScreenHeigth) collectionViewLayout:flowL_V];
        //隐藏指示条
        self.Classification.showsHorizontalScrollIndicator = NO;
        //关闭自动偏移
        self.automaticallyAdjustsScrollViewInsets = NO;
        //点击状态栏返回顶部
        self.Classification.scrollsToTop = YES;
        self.Classification.bounces = NO;
        self.Classification.backgroundColor = [UIColor colorWithRed:223 / 255.0 green:223 / 255.0 blue:223 / 255.0 alpha:1.0];
        ;
        self.Classification.contentOffset = CGPointMake(60 * ScreenWidth,  0);
        
        //签协议
        self.Classification.delegate = self;
        self.Classification.dataSource = self;
        //注册cell
        [self.Classification registerClass:[ClassificationCollectionViewCell class] forCellWithReuseIdentifier:@"ClassificationCell"];
        //整页滑动
        
        self.Classification.pagingEnabled = YES;
        
        [self.view addSubview:self.Classification];

        
        
        self.tableV = [[UITableView alloc] initWithFrame:CGRectMake(self.Classification.frame.origin.x + self.Classification.frame.size.width, self.HcollectionV.frame.origin.y + self.HcollectionV.frame.size.height, [UIScreen mainScreen].bounds.size.width - (self.Classification.frame.origin.x + self.Classification.frame.size.width), 700 * ScreenHeigth) style:UITableViewStylePlain];
        self.tableV.dataSource = self;
        self.tableV.delegate = self;
        [self.view addSubview:self.tableV];


        
        
        
    }
        

    
    //添加全屏右滑动手势
    id target = self.navigationController.interactivePopGestureRecognizer.delegate;
    // 创建全屏滑动手势，调用系统自带滑动手势的target的action方法
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:target action:@selector(handleNavigationTransition:)];
    // 设置手势代理，拦截手势触发
    pan.delegate = self;
    // 给导航控制器的view添加全屏滑动手势
    [self.view addGestureRecognizer:pan];
    // 禁止使用系统自带的滑动手势
    self.navigationController.interactivePopGestureRecognizer.enabled = NO;

    
    
    
}


- (void)buAction:(UIButton *)sender
{
    
    self.Concern = [UIButton buttonWithType:UIButtonTypeCustom];
    self.Concern.frame = CGRectMake(10 * ScreenWidth, [UIScreen mainScreen].bounds.size.height - 60 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width - 20 * ScreenWidth, 40 * ScreenHeigth);
    [self.Concern setTitle:@"立即关注" forState:UIControlStateNormal];
     self.Concern.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:200 / 255.0 blue:200 / 255.0 alpha:1.0];
    self.Concern.layer.masksToBounds = YES;
    self.Concern.layer.cornerRadius = 5 * ScreenWidth;
    [self.Concern addTarget:self action:@selector(buAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.Concern];

}




- (void)attentionAction:(UIButton *)sender
{
    
}

- (void)interfaceAction:(UIButton *)sender
{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
